#include <signal.h>
#include <stdio.h>
#include <unistd.h>

void alarmHandler(int signum) {
    printf("Alarm triggered! Interrupting the task...\n");
    printf("Task interrupted!\n");
}

void performLongTask() {
    printf("Performing a long task...\n");
    sleep(10);
    printf("Long task completed!\n");
}

int main() {
    signal(SIGALRM, alarmHandler);
    alarm(1);
    performLongTask();

    return 0;
}
